//*******************************************************************************
// COPYRIGHT NOTES
// ---------------
// This is a sample for BCGControlBar Library Professional Edition
// Copyright (C) 1998-2009 BCGSoft Ltd.
// All rights reserved.
//
// This source code can be used, distributed or modified
// only under terms and conditions 
// of the accompanying license agreement.
//*******************************************************************************
//
#if !defined(AFX_RECURRENCEDLG_H__291BCE7E_24A5_43F0_988F_688597792316__INCLUDED_)
#define AFX_RECURRENCEDLG_H__291BCE7E_24A5_43F0_988F_688597792316__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// RecurrenceDlg.h : header file
//
#include <ui/dialogbase.h>

#ifndef _USER_SYS_BCGCPRO_INCLUDE_
#include <BCGCBPro/BCGPRecurrenceRule.h>			// BCGPro Control Bar
#else    
#include <BCGPRecurrenceRule.h>
#endif

#include "RecurrenceRuleDlg.h"
#include "../Resource.h"
/////////////////////////////////////////////////////////////////////////////
// CRecurrenceDlg dialog

class CRecurrenceDlg : public CDialog
{
// Construction
public:
	CRecurrenceDlg(const CBCGPRecurrenceBaseRule* pRule, BOOL bHasRule,
				   BOOL bEcp, CWnd* pParent = NULL);   // standard constructor
	virtual ~CRecurrenceDlg();

// Dialog Data
	//{{AFX_DATA(CRecurrenceDlg)
	enum { IDD = IDD_APP_RECURRENCE };
	CStatic	m_wndPos;

	CComboBox	m_TimeStartCombo;
	CComboBox	m_TimeEndCombo;
	CComboBox	m_DurationCombo;

	COleDateTime m_timestart;
	COleDateTime m_timeend;
	COleDateTimeSpan m_duration;

	CDateTimeCtrl	m_DateStart;
	CDateTimeCtrl	m_LimitDate;

	DWORD			m_LimitCount;
	CButton			m_btnRuleDaily;
	CButton			m_btnRuleWeekly;
	CButton			m_btnRuleMonthly;
	CButton			m_btnRuleYearly;
	CButton			m_btnRemove;
	CButton			m_btnLimitNone;
	CButton			m_btnLimitCount;
	CButton			m_btnLimitDate;
	//}}AFX_DATA

	const CBCGPRecurrenceBaseRule* GetRule () const;

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CRecurrenceDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
public:

	void ChangeRule (DWORD index);
	//virtual CWnd* GetResizableWnd(){ return this; };
	// Generated message map functions
	//{{AFX_MSG(CRecurrenceDlg)
	virtual BOOL OnInitDialog();
	virtual void OnOK();
	afx_msg void OnRemove();
	afx_msg void OnRuleDaily();
	afx_msg void OnRuleWeekly();
	afx_msg void OnRuleMonthly();
	afx_msg void OnRuleYearly();
	afx_msg void OnLimitNone();
	afx_msg void OnLimitCount();
	afx_msg void OnLimitDate();
	afx_msg void OnTimeChangedS();
	afx_msg void OnTimeChangedE();
	afx_msg void OnDurationChanged();
	afx_msg void OnChangeCount();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnDtnDatetimechangeDateEnd(NMHDR *pNMHDR, LRESULT *pResult);
	void ChangeLanguage();
	void DSkinLiteSkin();

	afx_msg void OnCbnSelchangeStartTimeCombo();
	afx_msg void OnCbnSelchangeEndTimeCombo();
	afx_msg void OnCbnSelchangeDurationTimeCombo();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
private:
	void reset_dlg_size();
	void set_window_pos();
public:
	CArray<CBCGPRecurrenceBaseRule*, CBCGPRecurrenceBaseRule*> m_Rules;
	CBCGPRecurrenceRuleRegistrator::XBCGPRecurrenceRuleIDArray m_RulesID;
	DWORD m_ID;

	CArray<CRecurrenceRuleDlg*, CRecurrenceRuleDlg*> m_RulesDlg;
	CRecurrenceRuleDlg* m_Dialog;

	BOOL	m_bHasRule;
	BOOL	m_bEcp;

protected:
	afx_msg void OnClose();

	void retset_combobox_data();
	void change_rule_mode( int rulemode );
	void init_spanformat_table();
	bool is_right_time_format(const char * _pstrSrc );
public:
	
	afx_msg void OnBnClickedOk();
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_RECURRENCEDLG_H__291BCE7E_24A5_43F0_988F_688597792316__INCLUDED_)
